1. Field of the Invention
This invention generally relates to an electrical programmable event timer and, more particularly, to a timer that can be synchronized to operate with an external or network-derived time base.
2. Description of the Related Art
Programmable timers are widely used in the data processing and machine control fields. Some of the common tasks performed by most timers include input capture and output compare. An input capture function records (“captures”) the time at which an external event (electrical signal) occurs. For example, input capture may be used to read a limit switch or a temperature. An output compare function generates an output signal in response to programmed time intervals. For example, output compare can be used to run an electrical motor or solenoid. Input capture and output compare functions can be modified in response to commands from an associated programmable logic controller (PLC), programmable controller (PC), or microprocessor, and they may also be used to trigger interrupts in the PC program.
From these relatively simple functions, more complex operations such as pulse width modulation (PWM) can be performed using multiple cooperating channels, to operate a motor for example. A predetermined pulse width can be represented as a digital value, stored in a first timer channel register, and used to perform the pulse width modulation function. A second timer channel register can be used to store a first period value—the period of the pulse width. Likewise, a third timer channel register can be used to store a second (shorter) period value, which can be used to make the pulse width narrower, if feedback signals dictate that such an action is necessary.
The use of such dedicated circuitry insures that pulses are generated with the necessary pulse width, with a minimum of latency, if the pulse width must be made longer or shorter. A timer can perform at greater number of operations, more smoothly, with the assistance of an associated microprocessor. Using the master and slave registers presented above, the timer uses simple state logic to load the next data word from the slave register into the master register for a two-step operation, when the timed events are responding “normally”. However, in the event of an abnormal situation, the microprocessor can directly load a word into the master register, from memory, that is more appropriate for the situation.
For the sake of increased flexibility, some timer designs have opted to have all channel service operations performed in response to the execution of microprocessor/software instructions. However, the microprocessor consumes system resources. Generally, the microprocessor is responsible for other functions besides servicing the timer channels. Further, the latency associated with microprocessors and software instructions is much greater than hardware logic operations. Even more critical, the cost of designing the software to run a microprocessor-based timer can be very high.
The advantages associated with a timer that can perform operations independent of, or minimally dependent upon a PC, can become liabilities when the timer must be used in cooperation with other timers, or with other devices whose operations must be centrally controlled (e.g., by the PC). In these situations, it may be desirable to run all the cooperating devices, including the timer(s), from a common clock. While the PC may be enabled to run the cooperating operations, using the PC's clock as the central time base, this method of operation may be an inefficient use of the PC. Further, the latency associated with microprocessors and software instructions is much greater than hardware logic operations. Even more critical, the cost of designing the software to run the PC in this manner can be very high.
In a distributed control system using multiple clocks, individual clocks tend to drift apart. Some kind of correction mechanism is necessary to synchronize the individual clocks to maintain global time, which is accurate to some requisite clock resolution. For example, the IEEE 1588 standard for a precision clock synchronization protocol can be used for networked measurement and control systems. The IEEE standard defines several messages that can be used to exchange timing information. However, conventional timer cannot be synchronized to external sources such as IEEE 1588.
It would be advantageous if a timer channel time base could be easily synchronized with an external source.
It would be advantageous if a programmable timer could be synchronized for use as a system or network timing source.